package com.zhu.storesmanager.models;

import com.zhu.storesmanager.SvStoreCompeteActivity;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

/**
 * 竞品数据项
 */
public class CompeteProductItem {
    public String mBrandId; //品牌ID
    public String mBrandName; //品牌名字
    public String mModelID; //型号ID
    public String mModelName; //型号名字
    public String mPrice; //价格
    public String mDataIDs; //数据ID集合（活动或者功能）
    public String mDataNames; //数据名字集合（活动或者功能）
    public String mOther; //其他
    public String mSellcount; //销量
    public int mType; //类型( 1=竞品价格  2==新品功能  3==竞品活动)
    public Bitmap mPhoto = null;

    /**
     * 设置图片数据
     * @param data 图片数据
     */
    public void setImageData(byte[] data){
        if(data != null && data.length > 0){
            mPhoto = BitmapFactory.decodeByteArray(data, 0, data.length);
        }
    }

    /**
     * 复制数据
     * @param content 数据源
     */
    public void copyFrom(SyncModel.DataVisitContentCompetitor content){
    	mBrandName = content.Brands;
    	mModelName = content.Model;
    	mPrice = content.Price + "";
    	mSellcount = content.SaleNum + "";
    	if(mType == SvStoreCompeteActivity.TYPE_COMPETE_CONTENT_FUCTION){
    		mDataNames = content.Function;
    		mOther = content.OtherFunction;
    	}else{
    		mDataNames = content.Activity;
    		mOther = content.OtherActivity;
    	}
    }
}
